package com.hd.batch.quartz.batch.job.mapper;

import com.hd.batch.quartz.batch.job.pojo.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.item.file.mapping.FieldSetMapper;
import org.springframework.batch.item.file.transform.FieldSet;
import org.springframework.validation.BindException;

/**
 * <h3>partitionjob</h3>
 * <p>UserFieldSetMapper</p>
 *
 * @author : hduong
 * @version : 1.0
 * @date : 2020-09-10 16:47
 **/
@Slf4j
public class UserFieldSetMapper  implements FieldSetMapper<User> {

    @Override
    public User mapFieldSet(FieldSet fieldSet) throws BindException {
        log.info("****************helloWorld************************");
        return new User(fieldSet.readString("id"),
                fieldSet.readString("name"),
                fieldSet.readString("age"));

    }
}
